/*
 * SPDX-License-Identifier: Apache-2.0
 *
 * The OpenSearch Contributors require contributions made to
 * this file be licensed under the Apache-2.0 license or a
 * compatible open source license.
 *
 * Modifications Copyright OpenSearch Contributors. See
 * GitHub history for details.
 */

/*
 * Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */

package org.opensearch.performanceanalyzer.rca.configs;


import org.opensearch.performanceanalyzer.rca.framework.core.RcaConf;

public class QueueRejectionRcaConfig {
    private Integer rejectionTimePeriodInSeconds;
    public static final int DEFAULT_REJECTION_TIME_PERIOD_IN_SECONDS = 300;
    public static final String CONFIG_NAME = "queue-rejection-rca";

    public QueueRejectionRcaConfig(final RcaConf rcaConf) {
        rejectionTimePeriodInSeconds =
                rcaConf.readRcaConfig(
                        CONFIG_NAME,
                        RCA_CONF_KEY_CONSTANTS.REJECTION_TIME_PERIOD_IN_SECONDS,
                        DEFAULT_REJECTION_TIME_PERIOD_IN_SECONDS,
                        (s) -> (s > 0),
                        Integer.class);
    }

    public int getRejectionTimePeriodInSeconds() {
        return rejectionTimePeriodInSeconds;
    }

    public static class RCA_CONF_KEY_CONSTANTS {
        public static final String REJECTION_TIME_PERIOD_IN_SECONDS =
                "rejection-time-period-in-seconds";
    }
}
